package cn.mianshiyi.monitor;


import java.util.concurrent.atomic.AtomicLong;

/**
 * 统计次数;例如：统计qps
 * @author shangqing.liu
 */
public class AtomicCountCounter extends MonitorCounter {

    private final AtomicLong counter = new AtomicLong(0);

    @Override
    public Number getValueAndReset() {
        return counter.getAndSet(0);
    }

    @Override
    public void addValue(Number value) {
        counter.addAndGet(value.longValue());
    }

}
